package cmq.socket;


import java.io.PrintStream;
import java.net.Socket;
import java.util.Scanner;

/**
 * @ProjectName: interview
 * @Package: cmq.socket
 * @ClassName: BIOClient
 * @Author: chenmengqi
 * @Description:
 * @Date: 2020/2/18 4:41 下午
 * @Version: 1.0
 */
public class BIOClient2 {
    public static void main(String[] args) {
        try {
            for (int i = 0; i < 10; i++) {
                Socket socket = new Socket("127.0.0.1", 3000);


                Scanner scanner = new Scanner(System.in);
                String line = scanner.nextLine();

                PrintStream ps = new PrintStream(socket.getOutputStream());

                ps.println(line);

                ps.close();
                socket.close();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
